home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_08 / saks / locstruc.cpp < prev   
Encoding:
Text File  |  1995-06-06  |  379 b   |  21 lines

  1. Listing 1 - A suggested use for a struct definition local 
  2. to a block.
  3.  
  4. int xlate(const char *s)
  5.     {
  6.     struct entry
  7.         {
  8.         const char *s;
  9.         int v;
  10.         };
  11.     static const entry xtab[] =
  12.         {
  13.         { ..., ... },
  14.         ...
  15.         { ..., ... }
  16.         };
  17.     /*
  18.      * convert s to int by table lookup using xtab
  19.      */
  20.     }
  21.